<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://static.chimeroi.com/servicetool-temp/google-map-geometry.js"></script>
</head>
<!-- AIzaSyCWF2yaVDqFmvDOE9CbpsNxDVR4sIOCMyA -->

<body>

</body>
<script>
    let times = 10000 * 10000 * 10000
    let errCount = 0
    let successCount = 0
    let path = [
        {
            "lat": 37.368437974137436,
            "lng": -122.09758595341494
        },
        {
            "lat": 37.356176596786646,
            "lng": -122.04327390307238
        },
        {
            "lat": 37.38819607438692,
            "lng": -122.04947114700128
        }
    ]
    let getArea = () => {
        try {
            let area = window.google.maps.geometry.spherical.computeArea(
                path
            )
            console.log('successCount', area)
            successCount++
        } catch (e) {
            console.log('error:', e)
            errCount++
        }
    }
    getArea()
    let psFuncArr = []
    let calcArrFunc = []
    window.onload = async function () {
        for (let a = 0; a < 10000; a++) {
            calcArrFunc.push(() => {
                getArea()
            })

        }
        for (let a = 0; a < 10000; a++) {
            psFuncArr.push(() => {
                Promise.all(calcArrFunc.map(fn => fn()))
            })
        }



        // await Promise.all(psFuncArr.map(fn => fn()))
        // console.log('result', errCount, successCount)
    }
</script>

</html>